<!DOCTYPE html>
<html ng-app="app">

<head>
    <meta charset="utf-8">
    <title>修改密码</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="__STATIC__/index/css/mui.min.css">
    <link rel="stylesheet" href="__STATIC__/index/css/commen.css" />
    <link rel="stylesheet" href="__STATIC__/index/css/my/account/change_password.css" />
</head>

<body ng-controller="change_password_controller">
    <header class="mui-bar mui-bar-nav">
        <a class="mui-icon mui-icon-left-nav mui-pull-left" onclick="javascript :history.back(-1);"></a>
        <h1 class="mui-title">修改密码</h1>
    </header>
    <div id="pullrefresh" class="mui-content" >
        <div class="change_password">
            <p class="into_title">原密码:</p>
            <input type="password" class="init_input" id="old_pass" placeholder="若包含字母，请注意区分大小写" />
            <p class="into_title">新密码:</p>
            <input type="password" class="init_input" id="new_pass" placeholder="请输入新密码" />
            <button class="btn btn_orange" onclick="cclick()" >确定</button>
        </div>
    </div>
    <div id="pop_into" class="mui-popover mui-popover-action mui-popover-bottom">
        <div class="pop_container">
            <img src="__STATIC__/index/img/my/success.png" alt="" class="gift_box" style="margin-top: 25px;"/>
            <h4 style="margin-top: 25px;">修改密码成功</h4>
            <p style="padding: 15px 0;">请使用新登录密码登录</p>
            <button class="pop_btn" ng-click="close_pop()" style="width:40%;">我知道了</button>
        </div>
        <div class="close_container" ng-click="close_pop()">
            <i class="mui-icon mui-icon-close"></i>
        </div>
    </div>
    <script src="__STATIC__/index/js/mui.min.js"></script>
    <script src="__STATIC__/index/js/jquery.min.js"></script>
    <script src="__STATIC__/index/js/angular.min.js"></script>
    <script src="__STATIC__/index/js/my/account/change_password.js"></script>
    <script src="__STATIC__/layer/layer.js"></script>
</body>
</html>
<script type="text/javascript">
    function cclick() {
        var old_pass = $("#old_pass").val();
        var new_pass = $('#new_pass').val();
        $.post("{:url('user/change_pass')}", { old_pass: old_pass, new_pass: new_pass},
            function (data) {
                if (data.code == 1) {
                    loading();
                } else {
                    layer.msg(data.msg);
                }
            });

    }     function loading() {
            mui('#pop_into').popover('show');
            var home_second = 2;
            var homeTimer;
            var homeTimer = setInterval(function () {
                home_second--;
                if (home_second <= 0) {
                    window.clearInterval(homeTimer);
                    //执行跳转操作
                    location.href = "{:url('login/index')}";
                }
            }, 1000)
    }
</script>